<?php

use think\facade\Route;

/** 圈子路由 无需登录 */
Route::group(function () {

    Route::get('list', '@getCircleList');
    Route::get('$', '@getCircle');
    Route::get('user/list$', '@getUserCircleList');

})->prefix('\app\circle\service\Circle')->middleware(['withoutLogin']);

/** 圈子路由 需要登录 */
Route::group(function () {

    Route::post('$', '@createCircle');
    Route::delete('$', '@deleteCircle');
    Route::get('recircle$', '@recircleFetch');
    Route::post('recircle$', '@recircle');
    Route::post('comment$', '@comment');
    Route::delete('comment$', '@deleteComment');
    Route::post('like$', '@like');
    Route::get('mine/list$', '@getMyCircleList');

})->prefix('\app\circle\service\Circle');

/**
 * 后端管理接口
 */
Route::group('admin', function () {
    // 列表
    Route::get('list', '@getList');
    // 批量删除
    Route::delete('deletes/<ids>', '@deletes')->pattern(['ids' => '[\d,]+']);
    Route::group('<id>', function () {
        // 删除
        Route::delete('delete', '@delete');
        // 推荐动态
        Route::put('recommend', '@recommend');
        // 圈子详情
        Route::get('detail', '@detail');
    })->pattern(['id' => '\d+']);
})->prefix(\app\circle\service\admin\Circle::class)->middleware(['adminRoute']);